#!/usr/bin/env bash
# set -x
set -uo pipefail
###
# 部署完毕后禁用configure.sh脚本，避免重复执行configure.sh，搞乱配置信息
###

cd `dirname ${BASH_SOURCE[0]}`
SHELL_FOLDER=$(pwd)
DEPLOY_ROOT=$(cd ../ && pwd)
source $DEPLOY_ROOT/utils/log.sh

file_config=$DEPLOY_ROOT/configure.sh

cd $SHELL_FOLDER
INFO "Unable configure.sh after installation: append exit 1 and error info to configure.sh"

# 在指定行前插入一行
sed '10 i ERROR "Cannot run configure.sh again after installation."' -i $file_config
# 在指定行后插入一行
sed '10 a exit 1' -i $file_config